using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using Mt.Site.Core.Base.Domain.Entities;
using Mt.Site.Core.Base.Tree;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Mt.Site.Core.Taxonomys.Entities
{
    public class TaxonomysItem : FullAuditedEntity<Guid>, ITreeItem<Guid>, IPassivable, INeedAuxiliaryId
    {
        public const int MaxValueLength = 100;
        public const int MaxLocalDisplayNameLength = 100;

        public const int MaxPicLength = 256;

        public const int MaxLinkUrlLength = 350;

        public const int MaxCodeLength = CodeHelper.MaxCodeLength;

        public const int MaxDisplayNameLength = 128;

        public virtual Guid? ParentId { get; set; }

        [Required]
        [StringLength(MaxDisplayNameLength)]
        public virtual string DisplayName { get; set; }

        /// <summary>
        /// Hierarchical Code of this organization unit.
        /// Example: "00001.00042.00005".
        /// This is a unique code for a Tenant.
        /// It's changeable if OU hierarch is changed.
        /// </summary>
        [Required]
        [StringLength(MaxCodeLength)]
        public virtual string Code { get; set; }


        [NotMapped]
        [StringLength(MaxLocalDisplayNameLength)]
        public string LocalDisplayName { get; set; }

        [NotMapped]
        public bool IsBindItem { get; set; }

        [StringLength(MaxValueLength)]
        public string Value { get; set; }

        public int Norder { get; set; }
        [Required]
        public Guid TypeId { get; set; }

        public bool IsActive { get; set; }

        [StringLength(MaxPicLength)]
        public string Pic1 { get; set; }

        [StringLength(MaxPicLength)]
        public string Pic2 { get; set; }

        public long AuxiliaryId { get; set; }

        [StringLength(MaxLinkUrlLength)]
        public string LinkUrl { get; set; }
    }
}
